
package com.funong.matrix.biz.base.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.funong.matrix.core.base.FunongBaseEntity;
import com.funong.matrix.core.enums.IsDeletedEnum;
import com.funong.matrix.core.enums.StatusEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * @author : NaNa
 * @since : 2023-05-18 18:56
 **/
@Data
@TableName("sys_menu")
@Accessors(chain = true)
public class SysMenuEntity extends FunongBaseEntity {

    /**
     * 菜单编码
     */
    @ApiModelProperty(value = "菜单编码")
    private String code;

    /**
     * 菜单名称
     */
    @ApiModelProperty(value = "菜单名称")
    private String name;

    /**
     * 父菜单编码
     */
    @ApiModelProperty(value = "父菜单编码")
    private String parentCode;

    /**
     * 层级
     */
    @ApiModelProperty(value = "层级")
    private Integer level;

    /**
     * 资源路径
     */
    @ApiModelProperty(value = "资源路径")
    private String url;

    /**
     * 系统（1 黄河 2 昆仑）
     * {@link com.funong.matrix.core.enums.SystemIdEnum}
     */
    @ApiModelProperty(value = "系统（1 黄河 2 昆仑）")
    private Integer systemId;

    /**
     * 图标
     */
    @ApiModelProperty(value = "图标")
    private String icon;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    private Integer orderNum;

    /**
     * 状态
     */
    @ApiModelProperty(value = "状态(0 禁用 1启用)")
    private Integer status;

    @TableField(exist = false)
    private List<SysMenuEntity> children;

    public static final LambdaQueryWrapper<SysMenuEntity> gw() {
        return new LambdaQueryWrapper<SysMenuEntity>().eq(FunongBaseEntity::getIsDeleted, IsDeletedEnum.NOT_DELETED.getValue()).eq(SysMenuEntity::getStatus, StatusEnum.ENABLE.getValue());
    }
}

